// 状态枚举
const stateTypeEnum = [{"value": "NO", "name": "禁用"}, {"value": "YES", "name": "可用"}];

// 数据类型枚举
const dataTypeEnum = [{"value": "INTEGER", "name": "整数型"},
  {"value": "LONG", "name": "长整数型"},
  {"value": "FLOAT", "name": "浮点型"},
  {"value": "DOUBLE", "name": "双精度浮点型"},
  {"value": "STRING", "name": "字符型"},
  {"value": "BOOLEAN", "name": "布尔型"},
  {"value": "OBJECT", "name": "对象"}];

// 属性参数枚举
const codeDataTypeEnum = [{"value": "PROP", "name": "属性"},
  {"value": "INPUT_PARAM", "name": "输入参数"}];

// 条件场景枚举
const sceneTypeEnum = [{"value": "FILTER_PARAM", "name": "筛选参数"},
  {"value": "CIRCUIT_SELECT", "name": "电路选择"},
  {"value": "ELEMENT_SELECT", "name": "电路生成"}];

// 电路类型枚举
const circuitTypeEnum = [{"value": "SENSOR", "name": "数据采集电路模块", "code": "sensor"},
  {"value": "CONTROLLER", "name": "数据处理电路模块", "code": "controller"},
  {"value": "POWER", "name": "电源电路模块", "code": "power"},
  {"value": "PCB", "name": "pcb电路模块", "code": "pcb"}];

// 采集类型枚举
const signalTypeEnum = [{"value": "OTHER", "name": "无"},
  {"value": "VOLTAGE", "name": "电压"},
  {"value": "CURRENT", "name": "电流"},
  {"value": "ACCELERATION", "name": "加速度"},
  {"value": "TEMPERATURE", "name": "温度"},
  {"value": "HUMIDITY", "name": "湿度"},
  {"value": "PRESSURE", "name": "气压"},
  {"value": "VIBRATE", "name": "振动"}  ];

// 存储类型枚举
const storageTypeEnum = [{"value": "OTHER", "name": "无"},
  {"value": "SDRAM", "name": "SDRAM"},
  {"value": "FLASH", "name": "Flash"},
  {"value": "TF", "name": "TF卡"}];

// 模块类型枚举
const moduleTypeEnum = [
  {"value": "cae", "name": "第三方仿真软件"},
  {"value": "circuitDesign", "name": "电路生成专家系统"},
  {"value": "diagnosisPredict", "name": "诊断预测算法生成"},
  {"value": "driverAdapt", "name": "驱动程序参数化"},
  {"value": "pbcDesign", "name": "PCBA建模"},
  {"value": "reliability", "name": "多物理场仿真-腾睿自研"},
  {"value": "signalAnalysis", "name": "信号完整性分析"},
  {"value": "simulation", "name": "多应力仿真自主引擎"},
  {"value": "testability", "name": "测试性建模"}];

const serverAvailableStateEnum = [
  {"value": "YES", "name": "可用"},
  {"value": "NOT", "name": "停用"}];

const serverWorkStateEnum = [
  {"value": "FREE", "name": "空闲"},
  {"value": "BUSY", "name": "繁忙"}];


// 获取单个数据类型
function getOneDataType(val) {
  for (let i = 0; i < dataTypeEnum.length; i++) {
    if (val === dataTypeEnum[i].value) {
      return dataTypeEnum[i].name
    }
  }
}

// 获取单个编码类型
function getOneCodeType(val){
  for (let i = 0; i < codeDataTypeEnum.length; i++){
    if (val === codeDataTypeEnum[i].value){
      return codeDataTypeEnum[i].name
    }
  }
}

// 获取单个电路类型
function getOneCircuitType(val){
  for (let i = 0; i < circuitTypeEnum.length; i++){
    if (val === circuitTypeEnum[i].value){
      return circuitTypeEnum[i].name
    }
  }
}

// 获取单个电路类型
function getOneCircuitTypeCode(val){
  for (let i = 0; i < circuitTypeEnum.length; i++){
    if (val === circuitTypeEnum[i].value){
      return circuitTypeEnum[i].code
    }
  }
}

function getSignalType(val) {
  for (let i = 0; i < signalTypeEnum.length; i++){
    if (val === signalTypeEnum[i].value){
      return signalTypeEnum[i].name
    }
  }
}

function getStorageType(val) {
  for (let i = 0; i < storageTypeEnum.length; i++){
    if (val === storageTypeEnum[i].value){
      return storageTypeEnum[i].name
    }
  }
}

function getModuleType(val) {
  for (let i = 0; i < moduleTypeEnum.length; i++){
    if (val === moduleTypeEnum[i].value){
      return moduleTypeEnum[i].name
    }
  }
}

function getServerAvailableStateType(val) {
  for (let i = 0; i < serverAvailableStateEnum.length; i++){
    if (val === serverAvailableStateEnum[i].value){
      return serverAvailableStateEnum[i].name
    }
  }
}

function getServerWorkStateType(val) {
  for (let i = 0; i < serverWorkStateEnum.length; i++){
    if (val === serverWorkStateEnum[i].value){
      return serverWorkStateEnum[i].name
    }
  }
}


export default {
  stateTypeEnum,
  dataTypeEnum,
  codeDataTypeEnum,
  sceneTypeEnum,
  circuitTypeEnum,
  signalTypeEnum,
  storageTypeEnum,
  moduleTypeEnum,
  serverAvailableStateEnum,
  serverWorkStateEnum,
  getOneDataType,
  getOneCodeType,
  getOneCircuitType,
  getOneCircuitTypeCode,
  getSignalType,
  getStorageType,
  getModuleType,
  getServerAvailableStateType,
  getServerWorkStateType,
}
